package com.hlx.mall.product.controller;

import com.hlx.mall.common.BaseResponse;
import com.hlx.mall.common.ResultUtils;
import com.hlx.mall.product.domain.PmsCategory;
import com.hlx.mall.product.service.PmsCategoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("product/category")
public class CategoryController {
    
    @Resource
    private PmsCategoryService pmsCategoryService;
    
    @GetMapping("/list/tree")
    public BaseResponse<List<PmsCategory>> list() {
        List<PmsCategory> list = pmsCategoryService.listWithTree();
        return ResultUtils.success(list);
    }
    
}
